package com.Day4;

/**
 * Copyright (C), 2018-2021, 若若叶
 * Author: Hx162
 * Date: 2021/7/8 20:03
 * FileName: Vehicle
 * Description: 作业1
 */
public class Vehicle {
    private Double speed;  // 速度
    private Double size;  //体积

    public Vehicle() {
    }

    public Vehicle(Double speed, Double size) {
        this.speed = speed;
        this.size = size;
    }

    public Double getSpeed() {
        return speed;
    }

    public void setSpeed(Double speed) {
        this.speed = speed;
    }

    public Double getSize() {
        return size;
    }

    public void setSize(Double size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return "Vehicle{" +
                "speed=" + speed +
                ", size=" + size +
                '}';
    }

    /**
     * 机车移动
     */
    public void move(){
        System.out.println("Vehicle is moving...");
    }

    public void speedUp(){
        speed++;
        System.out.println("加速成功，现在速度为：" + speed);
    }

    public void speedDown(){
        speed--;
        System.out.println("加速成功，现在速度为：" + speed);
    }


}
